import {MovieModel} from "../../../models/movie";
const movies=new MovieModel();
import {cast} from "../../../utils/util";
Page({
  data: {

  },
  onLoad: function (options) {
     var id=options.id;
     movies.getsubject(id,res=>{
       this.handleData(res)
     })
     wx.hideLoading()
  },
handleData(res){
  // console.log(res)
  var title=res.title;
  wx.setNavigationBarTitle({
    title,
  })
  var average=res.rating.average;
  var year=res.title+'('+res.year+')';
  var directors=res.directors[0].name;
  var imgUrl=res.images.small;
  var casts=cast(res.casts);
  var summary=res.summary;
  var movies={
    title,
    average,
    year,
    directors,
    imgUrl,
    casts,
    summary
  };
  this.setData(movies)
}
})